#include <iostream>
#include <cmath>
#define N 100

using namespace std;

void read_matrix_a(int matrix_a[N][N], int row, int column){
int i, j;
for (i=0;i<row;i++)
    for(j=0;j<column;j++){
        cout<<"["<<i<<"]["<<j<<"]= ";
        cin>>matrix_a[i][j];}
}

void read_matrix_b(int matrix_b[N][N], int row, int column){
int i, j;
for (i=0;i<row;i++)
    for(j=0;j<column;j++){
        cout<<"["<<i<<"]["<<j<<"]= ";
        cin>>matrix_b[i][j];}
}

void print_matrix_c(int matrix_c[N][N], int row, int column){
int i,j;
for (i=0;i<row;i++){
    for(j=0; j<column; j++)
			cout<<matrix_c[i][j]<<" ";
		cout<<endl;}
}

int main(){
int row;
int column;
int matrix_a[N][N];
int matrix_b[N][N];
int matrix_c[N][N];
int i,j;


cout<<"Type the number of rows for A and B: " ;
cin>>row;
cout<<"Type the number of columns for A and B: " ;
cin>>column;

cout<<"Matrix A: "<<endl;
read_matrix_a(matrix_a, row, column);
cout<<"Matrix B: "<<endl;
read_matrix_b(matrix_b, row, column);

for(i=0;i<row;++i)
		for(j=0;j<column;++j)
			matrix_c[i][j]=max(matrix_a[i][j], matrix_b[i][j]); //max from cmath

cout<<"The matrix C is: "<<endl;
print_matrix_c(matrix_c, row,column);

return 0;
}
